//package com;
//
//
//import com.google.gson.*;
//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;
//import org.dom4j.Document;
//import org.dom4j.DocumentHelper;
//import org.dom4j.Element;
//import java.util.Map;
//import java.util.Set;
//
//public class Json2XML {
//    static Log logger = LogFactory.getLog(Json2XML.class);
//    static class ctx {
//        static String srcDecrypted = " {\"CommReq\":{\"qqfxitbh\":\"20\"},\"ISYS\":{\"ClientSystemId\":\"20\",\"RequestSerialNo\":\"GCZD2023113016260000011713\",\"ServiceCode\":\"CFS002001513\",\"SceneCode\":\"\",\"OrgNodeId\":null,\"signature\":\"304402207e65ab895e0a20905511d3bb232ef4fd3bcb742f1741477ab111a4fb50ac461902206a0689203e7bb59f68e23a1dbe87e4691102cc51bb4efec0ed43e4d751d009fd\",\"nonce\":\"956543957924\",\"timestamp\":\"1701332760\",\"GloSno\":\"GCZD2023113016260000011713\"},\"Req\":{\"orderApplyId\":\"1729685367957098497\",\"customerName\":null,\"certType\":null,\"certId\":null}}";
//        static String recv_yx = "";
//        static String sendChl = "";
//        static String recvChl = "";
//    }
//    public String charsetStr = "";
//    public static void main(String[] args) {
//
//
////        logger.info("-----TO JSON-----");
////        String data = json2xml(ctx.srcDecrypted);
////        logger.info("转换后的报文："+data);
//
//
////        JsonElement jsonTree = GsonUtil.gson().toJsonTree(ctx.srcDecrypted);
////        System.out.println(jsonTree);
//        String str = "Actual SQL: master ::: select RES.ID_, RES.REV_, RES.DUEDATE_, RES.PROCESS_INSTANCE_ID_, RES.EXCLUSIVE_ from ACT_RU_JOB RES where (RES.RETRIES_ > 0) and ( RES.DUEDATE_ is null or RES.DUEDATE_ <= ? ) and (RES.LOCK_OWNER_ is null or RES.LOCK_EXP_TIME_ < ?) and RES.SUSPENSION_STATE_ = 1 and ( ( RES.EXCLUSIVE_ = 1 and not exists( select J2.ID_ from ACT_RU_JOB J2 where J2.PROCESS_INSTANCE_ID_ = RES.PROCESS_INSTANCE_ID_ /*-- from the same proc. inst.*/ and (J2.EXCLUSIVE_ = 1) /*-- also exclusive*/ and (J2.LOCK_OWNER_ is not null and J2.LOCK_EXP_TIME_ >= ?) /*-- in progress*/ ) ) or RES.EXCLUSIVE_ = 0 ) and RES.TENANT_ID_ = ? LIMIT ? OFFSET ? ::: [2023-12-01 15:18:49.742, 2023-12-01 15:18:49.742, 2023-12-01 15:18:49.742, smlh, 3, 0]";
//        boolean contains = str.contains("select RES.ID_, RES.REV_, RES.DUEDATE_");
//        System.out.println(contains);
//        System.out.println(str);
//        Document document = DocumentHelper.createDocument();
//        Element root =  document.addElement("Message"); //默认根节点
//
//        try {
//            Element el = jsonToXml(ctx.srcDecrypted, root);
//            String s = el.asXML();
//            s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+s;
//            System.out.println(s);
//        } catch (Exception ex) {
//            logger.info("转换后的报文："+ex);
//        }
//
//
//
//
//    }
//
//    public static Element jsonToXml(String json, Element parentElement) throws Exception {
//        JsonObject jsonObject = new JsonParser().parse(json).getAsJsonObject();
//        Element ee = toXml(jsonObject, parentElement, null);
//        return ee;
//    }
//    /**
//     * 将json字符串转换成xml
//     * 待解析json对象元素
//     * @param jsonElement 上一层xml的dom对象
//     * @param parentElement 父节点
//     * @param name
//     */
//    public static Element toXml(JsonElement jsonElement, Element parentElement, String name) {
//        if (jsonElement instanceof JsonArray) {
//            //是json数据，需继续解析
//            JsonArray sonJsonArray = (JsonArray)jsonElement;
//            for (int i = 0; i < sonJsonArray.size(); i++) {
//                JsonElement arrayElement = sonJsonArray.get(i);
//                toXml(arrayElement, parentElement, name);
//            }
//        }else if (jsonElement instanceof JsonObject) {
//            //说明是一个json对象字符串，需要继续解析
//            JsonObject sonJsonObject = (JsonObject) jsonElement;
//            Element currentElement = null;
//            if (name != null) {
//                currentElement = parentElement.addElement(name);
//            }
//            Set<Map.Entry<String, JsonElement>> set = sonJsonObject.entrySet();
//            for (Map.Entry<String, JsonElement> s : set) {
//                toXml(s.getValue(), currentElement != null ? currentElement : parentElement, s.getKey());
//            }
//        } else if (jsonElement instanceof JsonNull) {
//            return parentElement;
//        } else {
//
//            //说明是一个键值对的key,可以作为节点插入了
//            addAttribute(parentElement, name, jsonElement.getAsString());
//        }
//        return parentElement;
//    }
//    /**
//     *
//     * @param element  	父节点
//     * @param name		子节点的名字
//     * @param value		子节点的值
//     */
//    public static void addAttribute(Element element, String name, String value) {
//        //增加子节点，并为子节点赋值
//        Element el = element.addElement(name);
//        el.addText(value);
//
//    }
////    static String xml2json(String xmlString) {
////        XMLSerializer xmlSerializer = new XMLSerializer();
////        xmlSerializer.setArrayName("contentArray");
////        JSON json = xmlSerializer.read(xmlString);
////        return json.toString().replace("[]","\"\"");
////    }
////    static String json2xml(String jsonString) {
////
////        XMLSerializer serializer = new XMLSerializer();
////        serializer.setArrayName("contentArray");
////        JSON json = JSONSerializer.toJSON(jsonString);
////        serializer.setRootName("Message");
////        serializer.setTypeHintsEnabled(false);
////
////        String write = serializer.write(json);
////        /*修复 产生多余 《e》节点*/
////        write = write.replaceAll("<e>","").replaceAll("</e>","");
////        return write;
////
////    }
//
//}
